package com.cocotingo.snail;

public interface AnimationFunction {

	float apply(float value);
	
	public static final AnimationFunction LINEAR = new AnimationFunction() {
		@Override
		public float apply(float value) {
			return value;
		}
	};
	public static final AnimationFunction EASE_IN = new AnimationFunction() {
		@Override
		public float apply(float value) {
			return value * value;
		}
	};
	public static final AnimationFunction EASE_OUT = new AnimationFunction() {
		@Override
		public float apply(float value) {
			return value * (2.0f - value);
		}
	};
	public static final AnimationFunction EASE_IN_EASE_OUT = new AnimationFunction() {
		@Override
		public float apply(float value) {
			return value <= 0.5f ? (2.0f * value * value) : (1.0f - 2.0f * (value - 1) * (value - 1));
		}
	};
	
}
